/*
 * 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙，邂逅框架梦]
 * 
 * https://zhiqim.org/project/zhiqim_framework/zhiqim_kernel.htm
 *
 * Zhiqim Kernel is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *          http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */
package org.zhiqim.zml.model.lists;

import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;

import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.annotation.AnNew;

/**
 * 定义一个LinkedList<String>对象，在ZML中new时不需要指定泛型
 *
 * @version v1.0.0 @author zouzhigang 2016-10-25 新建与整理
 */
@AnAlias("LinkedListS")
@AnNew
public class LinkedListS extends ListS
{
    private final LinkedList<String> instance;
    
    public LinkedListS()
    {
        instance = new LinkedList<>();
    }
    
    public LinkedListS(Collection<String> instance)
    {
        this.instance = new LinkedList<>(instance);
    }
    
    public LinkedListS(ListS instance)
    {
        this.instance = new LinkedList<>(instance.instance());
    }
    
    /***********************************************************/
    //实例化
    /***********************************************************/
    
    /**
     * 返回对应的List实例
     * 
     * @return          List实例
     */
    public LinkedList<String> instance()
    {
        return instance;
    }
    
    /***********************************************************/
    //私有方法
    /***********************************************************/
    
    public String getFirst() 
    {
        return instance.getFirst();
    }

    public String getLast() 
    {
        return instance.getLast();
    }

    public String removeFirst() 
    {
        return instance.removeFirst();
    }

    public String removeLast() 
    {
        return instance.removeLast();
    }
    
    public void addFirst(String e) 
    {
        instance.addFirst(e);
    }

    public void addLast(String e) 
    {
        instance.addLast(e);
    }
    
    /** @since 1.5 */
    public String peek() 
    {
        return instance.peek();
    }

    /** @since 1.5 */
    public String element() 
    {
        return instance.element();
    }

    /** @since 1.5 */
    public String poll() 
    {
        return instance.poll();
    }

    /** @since 1.5 */
    public String remove() 
    {
        return instance.remove();
    }

    /** @since 1.5 */
    public boolean offer(String e) 
    {
        return instance.offer(e);
    }

    /** @since 1.6 */
    public boolean offerFirst(String e) 
    {
        return instance.offerFirst(e);
    }

    /** @since 1.6 */
    public boolean offerLast(String e) 
    {
        return instance.offerLast(e);
    }
    
    /** @since 1.6 */
    public String peekFirst() 
    {
        return instance.peekFirst();
     }

    /** @since 1.6 */
    public String peekLast() 
    {
        return instance.peekLast();
    }

    /** @since 1.6 */
    public String pollFirst() 
    {
        return instance.pollFirst();
    }

    /** @since 1.6 */
    public String pollLast() 
    {
        return instance.pollLast();
    }

    /** @since 1.6 */
    public void push(String e) 
    {
        instance.push(e);
    }

    /** @since 1.6 */
    public String pop() 
    {
        return instance.pop();
    }

    /** @since 1.6 */
    public boolean removeFirstOccurrence(String o) {
        return instance.removeFirstOccurrence(o);
    }

    /** @since 1.6 */
    public boolean removeLastOccurrence(String o) 
    {
        return instance.removeLastOccurrence(o);
    }
    
    /** @since 1.6 */
    public Iterator<String> descendingIterator()
    {
        return instance.descendingIterator();
    }
}
